package com.shipwe.loans.ui.adapter

import androidx.recyclerview.widget.RecyclerView
import com.shipwe.adapter.ShipweRecyclerViewAdapter
import com.shipwe.adapter.ShipweViewHolderHelper
import com.shipwe.loans.R
import org.json.JSONObject

/**
 * Shipwe
 * @Author wwdeng
 * @CreateTime: 2024/11/11 16:14
 * @Annotation：菜单
 */
class MenuItemAdapter(recyclerView: RecyclerView?) : ShipweRecyclerViewAdapter<JSONObject>(recyclerView, R.layout.fragment_menu_item) {

    override fun setItemChildListener(helper: ShipweViewHolderHelper, viewType: Int) {
        helper.setItemChildClickListener(R.id.menuItem) //点击Item
    }

    override fun fillData(helper: ShipweViewHolderHelper, position: Int, model: JSONObject) {
        val imgMenuIcon = helper.getImageView(R.id.menuItemIcon)
        imgMenuIcon.setImageResource(model.optInt("menuIcon"))
        helper.setText(R.id.menuItemTitle,model.optString("menuTitle"))
    }
}